package com.hhf.study.config;

import com.hhf.study.service.ChatAssistant;
import dev.langchain4j.model.chat.ChatLanguageModel;
import dev.langchain4j.model.openai.OpenAiChatModel;
import dev.langchain4j.service.AiServices;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Daniel-黄海峰
 * @Description
 * @create 2025/8/2 20:46
 */
@Configuration(proxyBeanMethods = false)
public class ChatLanguageModelConfig
{
//    @Bean
//    public ChatLanguageModel chatLanguageModel()
//    {
//        return
//                OpenAiChatModel.builder()
//                .apiKey(System.getenv("LANGCHAIN4J_KEY"))
//                .modelName("qwen-turbo-0624")
//                .baseUrl("https://dashscope.aliyuncs.com/compatible-mode/v1")
//                .build();
//    }


    @Bean
    public ChatLanguageModel chatLanguageModel()
    {
        return
                OpenAiChatModel.builder()
                        .apiKey(System.getenv("LANGCHAIN4J_KEY"))
                        .modelName("deepseek-chat")
                        .baseUrl("https://api.deepseek.com/v1")
                        .build();
    }

    @Bean
    public ChatAssistant chatAssistant(ChatLanguageModel chatLanguageModel){
        return AiServices.create(ChatAssistant.class,chatLanguageModel);
    }



}

